using System;
using System.Collections.Generic;
using System.Text;

namespace Adoor.Mapping.Attributes
{
    [Serializable, AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
    public class OneToManyAttribute : BaseAttribute
    {
        public OneToManyAttribute()
            : base(0)
        {
        }

        public OneToManyAttribute(int position)
            : base(position)
        {
        }

        /*
         <Lieu>
      <typing:reference navigable="false" type="Adoor.Domain.Tiers.Lieu, Adoor.Domain.Tiers" target="Lieu" multiplicity="1" adjacentMultiplicity="*" parent="Adresse" xmlns:env="urn:xmd-environment" />
      <mapping:reference stored="true" class="Adoor.Object.Relational.ForeignKeyFactory, Adoor.Object.Relational" foreignKey="id_Lieu" type="System.String" xmlns:env="urn:xmd-environment" />
    </Lieu>
         */





        public Type ProviderClass
        {
            get { return providerClass; }
            set { providerClass = value; }
        }

        public string Target
        {
            get { return target; }
            set { target = value; }
        }

        public string Parent
        {
            get { return parent; }
            set { parent = value; }
        }

        public bool Navigable
        {
            get { return navigable; }
            set { navigable = value; }
        }

        public Multiplicity Multiplicity
        {
            get { return multiplicity; }
            set { multiplicity = value; }
        }

        public Multiplicity AdjacentMultiplicity
        {
            get { return adjacentMultiplicity; }
            set { adjacentMultiplicity = value; }
        }

        public string ForeignKeyColumn
        {
            get { return column; }
            set { column = value; }
        }



        public bool Stored
        {
            get { return stored; }
            set { stored = value; }
        }


        public Type ForeignKeyType
        {
            get { return foreignKeyType; }
            set { foreignKeyType = value; }
        }

        private Type foreignKeyType = typeof(string);
        private Type providerClass = Type.GetType("Adoor.Object.Relational.ForeignKeyFactory, Adoor.Object.Relational"); //typeof(global::Adoor.Object.Relational.ForeignKeyFactory);
        private bool navigable = false;
        private string target = string.Empty;
        private string parent = string.Empty;
        private Multiplicity multiplicity = Multiplicity.ONE;
        private Multiplicity adjacentMultiplicity = Multiplicity.ZERO_MANY;
        private bool stored = true;
        private string column = string.Empty;

        public override void AcceptVisitor(IVisitor visitor, System.Reflection.MemberInfo member)
        {
            visitor.Visit(this, member);
        }
    }
}
